<template>
   <div>
    <MyHeader title="yk购物车案例" color="blue" bgc="pink"></MyHeader>
    <div class="main">
      <MyGoods v-for="obj in list" :key="obj.id" :obj="obj"></MyGoods>
    </div>
    <MyFooter :list="list"></MyFooter>
  </div>
</template>

<script>
import MyHeader from './components/MyHeader'
import MyGoods from './components/MyGoods'
import MyFooter from './components/MyFooter'
export default {
  components: {
    MyHeader,
    MyGoods,
    MyFooter
  },
  data () {
    return {
      list: []
    }
  },
  created () {
   this.$axios({
    url: "/api/cart"
   }).then(res => {
    console.log(res)
    this.list = res.data.list
   })
  }
}
</script>

<style>
  .main{
    padding-top: 45px;
    padding-bottom: 50px;
  }
</style>